package com.zcyr.util;

import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;

public class TokenTool {
    private static final Map<String, String> tokens = new ConcurrentHashMap<>();

    public static String generate(String v){
        String token = UUID.randomUUID().toString().replace("-", "");
        tokens.put(token, v);
        return token;
    }

    public static String getAndDel(String token){
        return tokens.getOrDefault(token, null);
    }

    public static String get(String token){
        return tokens.getOrDefault(token, null);
    }
}
